home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 19
/
Aminet 19 (1997)(GTI - Schatztruhe)[!][Jun 1997].iso
/
Aminet
/
comm
/
cnet
/
comparebbstext.lha
/
CompareBBSText
next >
Wrap
Text File
|
1997-03-22
|
8KB
|
162 lines
/**************************************************************************\
$VER: Compare BBSText Files, v1.00 (22-Mar-97) by Dotoran!
\**************************************************************************/
options results;signal on SYNTAX;signal on ERROR;signal on IOERR
a=sourceline(2);parse var a . ", "ver" ("vdate")" .;a=random(,,time("s"))
tr=transmit;se=sendstring;gc=getchar;gu=getuser;gs=getscratch;mg=maygetchar
a="rexxsupport.library";if ~show("l",a) then if ~addlib(a,0,-30) then exit
parse source . . fp .;df=left(fp,max(lastpos('/',fp),lastpos(':',fp)))
/****** SysOp Definable Variables *******************************************/
/* ALL FOUR CAN BE EDITED ONCE INSIDE */
oldfile="cnet:bbstext." /* Location of OLD Stock BBSText file */
newfile="cnet:!bbstext_stock" /* Location of NEW Stock BBSText file */
modfile="cnet:bbstext" /* Location of YOUR Custom BBSText */
confile="cnet:bbstext.con" /* The Converted BBSText path/filename */
logging=2 /* 0=Off, 1=Minimal, 2=Full */
logfile="SysData:Log/BBSTextDiff" /* Log path/filename */
Llength=0 /* Maximum Line Length: 0-> Less than 1000 (Fastest Processing)
1-> Up to 2000
2-> Of ANY Length (Slowest Processing) */
/****** Start of Program Code Below; Hands Off! hehe ************************/
gu 1100645 ; editor=result /* Change to VisEd if not already set */
if editor=0 then do;setobject "1";putuser 1100645;end;lf="0A"x
changewhere "CompareBBSText" ; oldwh=result
gu 2124557 ; lace=result /* Check Interlaced Setting */
if lace=0 then do
se "n2 It is recommended that you run this program in Full Interlaced "
se "display mode. Your Interlace setting shows as being OFF right now. "
se "Some of the displays used in this program may scroll off your screen. "
se "You can opt to switch Full Interlaced mode right now. Press any key "
se "either after you have switched modes, or to continue in NonInterlaced "
se "mode.g1" ; end
tr "f1n1Compare CNet BBSText Files, "ver" last updated: "vdate"n1"
GETOLD:
se "Filename of the Old Version Original: L1305640 #"oldfile"}I4 30}"
gu 70;oldfile=result;if ~exists(oldfile) then do
tr "`"oldfile"' could NOT be found! <Key>g1";signal GETOLD;end
GETNEW:
se "Filename of the New Version Original: L1305640 #"newfile"}I4 30}"
gu 70;newfile=result;if ~exists(newfile) then do
tr "`"newfile"' could NOT be found! <Key>g1";signal GETNEW;end
GETMOD:
se "Filename of Your Modded Version File: L1305640 #"modfile"}I4 30}"
gu 70;modfile=result;if ~exists(modfile) then do
tr "`"modfile"' could NOT be found! <Key>g1";signal GETMOD;end
GETCON:
se "Filename to Save the Converted File: L1305640 #"confile"}I4 30}"
gu 70;confile=result;if exists(confile) then do
tr "`"newfile"' already exists! <Key>g1";signal GETCON;end
if logging>0 then do ; call open(l1,logfile,"W")
call writeln(l1,"BBSText Compare initiated on: "date()" at "time()lf);end
call open(o1,oldfile,"R") ; call open(n1,newfile,"R")
call open(m1,modfile,"R") ; call open(c1,confile,"W") ; tr "f1"
do i=1 until eof(n1) ; se "sReading/Writing Line: "right(i,4)"u"
select
when Llength=0 then do;old=readln(o1);new=readln(n1);mod=readln(m1);end
when Llength=1 then do
old=readln(o1);if length(old)=1000 then do;a=readln(o1);old=old||a;end
new=readln(n1);if length(new)=1000 then do;a=readln(n1);new=new||a;end
mod=readln(m1);if length(mod)=1000 then do;a=readln(m1);mod=mod||a;end
end
otherwise do
a="";old="";do until length(a)<1000;a=readln(o1);old=old||a;end
a="";new="";do until length(a)<1000;a=readln(n1);new=new||a;end
a="";mod="";do until length(a)<1000;a=readln(m1);mod=mod||a;end
end
end
if old=new then do;call writeln(c1,mod);iterate;end
if logging>0 then call writeln(l1,"Line Differences Found in Line "i".")
if logging=2 then do
call writeln(l1,lf"From OLD Stock BBSText"lf||translate(old,"{\","")||lf)
call writeln(l1,"From NEW Stock BBSText"lf||translate(new,"{\","")||lf)
call writeln(l1,"From MODified BBSText"lf||translate(mod,"{\","")||lf) ; end
tr "f1Line Differences Found in Line "i":n1"
tr "r1 Line "i" in your OLD Stock BBSText File... r0:n1" ; send old ; tr ; tr
tr "r1 Line "i" in your NEW Stock BBSText File... r0:n1" ; send new ; tr ; tr
tr "r1 Line "i" in your MODified BBSText File... r0:n1" ; send mod ; tr ; tr
tr "r1 Writing to the Conversion File named... r0: "confile"n1"
se "(E)dit the line, or write the (O)ld, (M)odded, or [NEW] line: "
gc ; a=result
select
when a="O" then do;tr "Old";call writeln(c1,old)
call writeln(l1,"Wrote the OLD Stock BBSText Line to `"confile"'."lf);end
when a="M" then do;tr "Mod";call writeln(c1,mod)
call writeln(l1,"Wrote the MODified BBSText Line to `"confile"'."lf);end
when index("EOM",a)=0 then do;tr "New";call writeln(c1,new)
call writeln(l1,"Wrote the NEW Stock BBSText Line to `"confile"'."lf);end
otherwise do ; tr "Edit"
se " Load the (O)ld, (M)odded, or [NEW] line for further editing: "
gc ; a=result ; if a="O" then do;tr "Old";line=old;end
else if a="M" then do;tr "Mod";line=mod;end
else do;tr "New";line=new;end
call open(f1,"ram:cbt","W");call writeln(f1,line);call close(f1)
loadeditor "ram:cbt" ; calleditor 0 ; gu 1109865 ; st=result
/* st --> 1=saved, 0=empty, -1=aborted editor */
if st<1 then do
call seek(o1,-(length(old)+1))
call seek(n1,-(length(new)+1))
call seek(m1,-(length(mod)+1))
i=i-1 ; iterate i ; end
else saveeditor "ram:cbt" ; cleareditor
call open(f1,"ram:cbt","R") ; line=""
do until eof(f1) ; a=readln(f1)
line=line||a ; end ; line=strip(line,"t")
call close(f1)
tr "The Edited Line "i" for use in the `"confile"' File:n1"
send line ; tr ; tr
se "Is it OK to write this line now? [Yes]: "
gc ; a=result ; if a="N" then do ; tr "No."
call seek(o1,-(length(old)+1))
call seek(n1,-(length(new)+1))
call seek(m1,-(length(mod)+1))
i=i-1 ; iterate i ; end
tr "Yes" ; call writeln(c1,line)
if logging=2 then call writeln(l1,"Wrote this Edited Line to `"confile"':"lf||translate(line,"{\","")||lf)
end
end
end i
call close(c1) ; call close(m1)
call close(n1) ; call close(o1)
/* If LineEd was originally set, change back to it before exiting. */
if editor=0 then do;setobject "0";putuser 1100645;end
se "n1ReName `"modfile"' as `"modfile".old' now? [Yes]: "
gc ; a=result ; if a="N" then do ; tr "No. Exiting..." ; signal DONE ; end
tr "Yes!" ; address command "rename "modfile" "modfile".old"
if logging>0 then call writeln(l1,"Renamed `"modfile"' to `"modfile".old'.")
se "ReName `"confile"' as `"modfile"' now? [Yes]: "
gc ; a=result ; if a="N" then do ; tr "No. Exiting..." ; signal DONE ; end
tr "Yes!" ; address command "rename "confile" "modfile
if logging>0 then call writeln(l1,"Renamed `"confile"' to `"modfile"'.")
if upper(left(modfile,5))="CNET:" then do
se "ReLoad the BBSText file into your system? [Yes]: "
gc ; a=result ; if a="N" then do ; tr "No. Exiting..." ; signal DONE ; end
tr "Yes!" ; addkeys ("RT`")
if logging>0 then call writeln(l1,"Reloaded BBSText file!")
end
DONE:
tr "n1BBSText Compare is now complete!"
if logging>0 then do
call writeln(l1,lf"BBSText Compare Completed on "date()" at "time()".")
call close(l1) ; end
changewhere oldwh
exit
SYNTAX:;ERROR:;IOERR:;e1="n1 Error: "rc" ("errortext(rc)")"
e2=" Line: "left(sigl,4)"File:";c="`"fp", "ver"'";e2=e2" "c;tr e1;tr e2
logentry e1;logentry e2;e=strip(translate(sourceline(sigl),"\{",""))
do while e~="";e3="Source: "left(e,37);tr e3;logentry e3;e=substr(e,38);end
bufferflush ; changewhere oldwh
/**************************************************************************\
\****************************************** Frontiers BBS (716)/823-9892 **/